Improve error messages in NMEA module.
authorrobertl <robertl>
Sun, 22 Oct 2006 22:12:38 +0000 (22:12 +0000)
committerrobertl <robertl>
Sun, 22 Oct 2006 22:12:38 +0000 (22:12 +0000)
nmea.c

diff --git a/nmea.c b/nmea.c
index fd18320dce503d0b4f1b1ac86991a41f4991baea..b078ba39ba95b8848ddb4052b89d9f0a0333878f 100644 (file)
--- a/nmea.c
+++ b/nmea.c
@@ -154,6 +154,7 @@ static struct tm tm;
 static waypoint * curr_waypt = NULL;
 static waypoint * last_waypt = NULL;
 static void * gbser_handle;
+static const char *posn_fname;
 
 static int without_date;       /* number of created trackpoints without a valid date */
 static struct tm opt_tm;       /* converted "date" parameter */
@@ -816,14 +817,15 @@ nmea_rd_posn_init(const char *fname)
                read_mode = rm_serial;
                gbser_set_speed(gbser_handle, 4800);
        } else {
-               fatal("Could not open %s\n", fname);
+               fatal(MYNAME ": Could not open %s.\n", fname);
        }
 
        if (opt_baud) {
                if (!gbser_set_speed(gbser_handle, atoi(opt_baud))) {
-                       fatal("Unable to set baud rate %s\n", opt_baud);
+                       fatal(MYNAME ": Unable to set baud rate %s\n", opt_baud);
                }
        }
+       posn_fname = fname;
 }
 
 static waypoint *
@@ -847,7 +849,7 @@ nmea_rd_posn(void)
                        warning( "READ: %s\n", ibuf);
                }
                if (rv < 0) {
-                       fatal("No data received.\n");
+                       fatal(MYNAME ": No data received on %s.\n", posn_fname);
                }
                nmea_parse_one_line(ibuf);
                if (lt != last_read_time) {